<h1><?php echo $title;?></h1>
<br>
<p><?php echo anchor("cschedule/create", '<button class="btn" type="button">Add new Schedule</button>');?></p>
<br>
<?php
if ($this->session->flashdata('message')){
	echo "<div class='message'>".$this->session->flashdata('message')."</div>";
}

if (count($schedules)){
	echo "<table id='rounded-corner' class='bordered-table zebra-striped' cellspacing='0' cellpadding='3' width='100%'>\n";
	echo "<thead>\n<tr valign='top'>\n";
	echo "<th>No</th><th>Source</th><th>Description</th><th>Semester</th><th>Academy</th><th>Actions</th>\n";
	echo "</tr>\n</thead>\n<tbody>\n";
	$i = 1;
	foreach ($schedules as $key => $list){
		echo "<tr valign='top'>\n";
		echo "<td align='center'>".$i++."</td>\n";
		echo "<td align='center'>";
		$extension = pathinfo($list['schedule_src'], PATHINFO_EXTENSION);
		if (strtolower($extension)=='gif' || strtolower($extension)=='jpg' || strtolower($extension)=='png') {
			echo "<img title='view image' class='img-popup' style='style:width:50px; height:50px;'  src=".base_url().'images/'.$_SESSION['username'].'/'.$list['schedule_src']." />";			
		}
		elseif (strtolower($extension)=='flv' || strtolower($extension)=='mp4' || strtolower($extension)=='dat' || strtolower($extension)=='avi' ){
			echo "<a href=".base_url().'images/'.$_SESSION['username'].'/'.$list['schedule_src'].">".$list['schedule_src']."</a>";
		}
		else{
			echo "<a href=".base_url().'images/'.$_SESSION['username'].'/'.$list['schedule_src'] .">".$list['schedule_src']."</a>";
		} 
		echo "</td>\n";
		echo "<td align='center'>".$list['description']."</td>\n";
		echo "<td align='center'>".$list['semester']."</td>\n";
		echo "<td align='center'>".$list['academy']."</td>\n";
		echo "<td align='center'>";
		echo anchor('cschedule/edit/'.$list['schedule_id'],'edit');
		echo " | ";
		echo anchor('cschedule/delete/'.$list['schedule_id'],'delete',array('class'=>'delete-item'));
		echo "</td>\n";
		echo "</tr>\n";
	}
	echo "</tbody>\n</table>";
}
?>